<template>
    <div class="theLaw-div">
        <div class="theLaw-head">
            GPC项目控制专业人士资格认证报名系统
            <div class="info-message" v-if="JSON.stringify(info) != '{}'">
                <img v-if="info.user.header" :src="$imgPath(info.user.header)" alt="">
                <span>{{info.user.name}}</span>
                <img class="tc" src="../../../static/img/tc.png" alt="" @click="goOut()">
            </div>
        </div>
    </div>
</template>
<script>
import apiHttp from '../../api/index.js'
export default {
    data(){
        return{
            info:{},
        }
    },
    mounted(){
        console.log(sessionStorage.getItem('infoImg'))
        if(sessionStorage.getItem('infoImg') == 1){
            this.infos()
        }else{
            this.detail()
        }
    },
    methods:{
        // 获取个人信息
        infos(){
            apiHttp.apiIndex.examDetail('').then(resp=>{
                if(resp.code == 0){
                    this.info = resp.data
                }
            })
        },
        detail(){
            apiHttp.apiIndex.orgdetail().then(resp=>{
                if(resp.code == 0){
                    if(resp.data){
                        this.info = resp.data
                    }
                }
            })
        },
        goOut(){
            this.$router.push({
                name:'login'
            })
            sessionStorage.removeItem('infoImg')
        },
        infoPath(){
            this.$router.push({
                path:'/students/index',
            })
        }
    }
}
</script>

<style lang="less" scoped>
.theLaw-div{
    width: 100%;
    height: 100%;
    .theLaw-head{
        background-image: url('../../../static/img/gh.png');
        background-repeat: no-repeat;
        background-position: 30px center;
        background-size: 45px;
        height: 70px;
        font-size: 24px;
        color: #fff;
        font-weight: bold;
        background-color: #5d2805;
        text-align: left;
        line-height: 70px;
        padding-left: 80px;
        .info-message{
            height: 70px;
            float: right;
            padding-right: 100px;
            img:nth-child(1){
                width: 40px;
                height: 40px;
                margin-top: 15px;
                border-radius: 50%;
                float: left;
                margin-right: 30px;
            }
            span{
                font-size: 16px;
                line-height: 70px;
                float: left;
                margin-right: 30px;
            }
            .tc{
                width: 25px;
                height: 25px;
                margin-top: 22px;
                float: left;
                cursor: pointer;
            }
        }
    }
}
</style>

